<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@page import="com.tcs.model.User"%>
<%@ page session="true"%>
<%
	User usuario=null;
	HttpSession sesionOk = request.getSession();
	if (sesionOk.getAttribute("usuario") == null) {
%>
<jsp:forward page="index.jsp">
	<jsp:param name="error" value="Es obligatorio identificarse" />
</jsp:forward>
<%
	} else {
		usuario = (User)sesionOk.getAttribute("usuario");
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<%@ include file="include-head.html"%>
</head>

<body>
	<!-- loading animation -->
	<div id="qLoverlay"></div>
	<div id="qLbar"></div>

<jsp:include page="include-header.jsp" />
 
	<div id="wrapper">
		<!--Sidebar background-->
		<div id="sidebarbg"></div>

		
<jsp:include page="include-sidebar.jsp" />



		<!--Body content-->
		<div id="content" class="clearfix">
			<div class="contentwrapper">
				<!--Content wrapper-->

				<div class="heading">
					<h3>Listado de Usuarios</h3>
				</div>
				<!-- End .heading-->

				<!-- Build page from here: -->
				<div class="row-fluid">
					<div class="span12">



						<!-- COMIENZO LISTADO TABLA DE ARTICULOS -->

						<div class="box chart gradient">

							<div class="title">

								<h4>
									<a href="#" title="Descargar Reporte" onclick="generateexcel('Listado de Usuarios', 'toXLS')" class="tip"><span class="icon16 icomoon-icon-download red"></span></a> <span>Listado de Usuarios</span>
								</h4>

							</div>
							<div class="content noPad clearfix">
									<c:if test="${!empty users}">
								<table id="toXLS" cellpadding="0" cellspacing="0" border="0"
									class="responsive dynamicTable display table table-bordered"
									width="100%">
									<thead>
										<tr>
											<th>Codigo</th>
											<th>Estado</th>
											<th>Nombre</th>
											<th>Apellido</th>
											<th>Usuario</th>
											<th>Password</th>
											<th>Modificar</th>
										</tr>
									</thead>
								
									<tbody>
										<c:forEach items="${users}" var="user">
											<tr class="odd gradeX">
												<td><c:out value="${user.userId}"/></td>
												<td><c:choose><c:when test="${user.valid}">
	  													<span class="e029 icomoon-icon-star"></span>
      													<br />
      												</c:when>
													<c:otherwise>
	  													<span class="e005 typ-icon-cross"></span>
    													<br />
      												</c:otherwise>
												</c:choose></td>	
												
												<td><c:out value="${user.firstName}"/></td>
												<td><c:out value="${user.lastName}"/></td>
												<td><c:out value="${user.username}"/></td>
												<td><c:out value="${user.password}"/></td>									
											
												<td>
													<div class="controls center">
														<a href="editUser.html?id=${user.userId}" title="Editar" class="tip"><span class="icon12 icomoon-icon-pencil"></span></a> 
														<a href="deactivateUser.html?id=${user.userId}" title="Desactivar" class="tip"><span class="icon12 icomoon-icon-remove"></span></a>
														<a href="activateUser.html?id=${user.userId}" title="Activar" class="tip"><span class="icon12 icomoon-icon-lightning"></span></a>
													</div>
												</td>
												
											
											</tr>
										</c:forEach>
									</tbody>
								</table>
								</c:if>
							</div>
						</div>
						<!-- End .box -->
					</div>
					<!-- End Span12 (ancho) -->
				</div>
				<!-- End .row-fluid -->
			</div>
			<!-- End contentwrapper -->
		</div>
		<!-- End #content -->
	</div>
	<!-- End #wrapper -->
	<%@ include file="include-javascript.html"%>
</body>
</html>